import requests
import json
import os
from dotenv import load_dotenv

load_dotenv()

response = requests.post(
    os.getenv('API_URL') + "/chat/completions",
    headers={
        "Content-Type": "application/json",
        "Authorization": f"Bearer {os.getenv('API_KEY')}"
    },
    json={
        "model": "Qwen2.5-72B-Instruct",
        "messages": [
            {"role": "system", "content": "你是一个友好的AI助手"},
            {"role": "user", "content": "请写一段网络安全的简要介绍，字数不超过200字"},
        ]
    }
)
if response.status_code == 200:
    print(response.json()["choices"][0]["message"]["content"]) 
else:
    print(response.json())